/**
 * @program: LeetCode
 * @ClassName Num050_
 * @description: LeetCode : 剑指 Offer 50. 第一个只出现一次的字符
 * @author: WXY
 * @create: 2022-12-09 19:40
 * @Version 1.0
 **/


public class Num050_firstUniqChar {
    public static char firstUniqChar(String s) {
        if (s.length() == 0) {
            return ' ';
        }
        int[] arr = new int[26];
        char[] str = s.toCharArray();
        for (int i = 0; i < str.length; i++) {
            arr[str[i] - 'a']++;
        }
        for (int i = 0; i < str.length; i++) {
            if (arr[str[i] - 'a'] == 1)
                return str[i];
        }
        return ' ';
    }

    public static void main(String[] args) {
        char leetcode = firstUniqChar("ll");
        System.out.println(leetcode);

    }
}
